package knapsack;

import evo.IInstance;
import evo.IInstanceBuilder;

public class KnapsackBuilder implements IInstanceBuilder {
	
	private KnapsackProblem _prob;

	public KnapsackBuilder(KnapsackProblem prob)
	{
		this._prob = prob;
	}

	@Override
	public IInstance createRandom() {
		KnapsackSolution sol = new KnapsackSolution(this._prob);
		sol.randomize();
		return sol;
	}

	@Override
	public IInstance[] createRandom(int n) {
		KnapsackSolution[] sols = new KnapsackSolution[n];
		for (int i = 0; i < sols.length; i++) {
			sols[i] = (KnapsackSolution)this.createRandom();
		}
		return sols;
	}

}
